package com.example.demo.threadPoolSafe;

import lombok.Data;

@Data
public class VoSafe {
    private String name;
    private String role;

    public synchronized void getVo(){
        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(this.name + "------饰演------" + this.role);
    }

    public synchronized void setVo(String name, String role){
        this.name = name;
        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        this.role = role;
    }

}
